$(function(){
    $(".about .txt p").addClass("trans00 ani-p-li");
    $(".partner .txt p").addClass("trans00 ani-p-l");

    $(".i_about p").addClass("trans00 ani-p-li");//内页

    //点击图片翻页
    if($("#pre").find("a").length==0){
        $("#pre1").click(function(){alert("对不起,没有上一个了！");return false})
    }else{
        $("#pre1").attr("href",$("#pre").find("a").attr("href"));
    }
    
    if($("#next").find("a").length==0){
        $("#next1").click(function(){alert("对不起,没有下一个了！");return false})
    }else{
        $("#next1").attr("href",$("#next").find("a").attr("href"));
    }
});

$(window).load(function(){
    var case_swiper=new Swiper('.case_swiper',{
        loop:true,
        navigation: {
          nextEl: '.swiper-next',
          prevEl: '.swiper-prev',
        },
        autoplay:{
            delay:4000,
            stopOnLastSlide: false,
            disableOnInteraction: true
        },
        spaceBetween : 26,
        speed:2500
    })
    var news_swiper=new Swiper('.news_swiper',{
        loop:true,
        navigation: {
          nextEl: '.new-next',
          prevEl: '.new-prev',
        },
        autoplay:{
            delay:3000,
            stopOnLastSlide: false,
            disableOnInteraction: true
        },
        spaceBetween : 26,
        speed:2000
    })
    // banner轮播图
    if($('.box_skitter_large')[0]){
        $('.box_skitter_large').skitter({
            theme: 'clean',
            enable_navigation_keys:false,
            label:true,
            interval:1000,
            dots:true,
            numbers_align: "center",
        });
        $(".prev_button").remove();
        $(".next_button").remove();
        $(".info_slide").css("left","0");
    }
    // 首页滚动动画
    $(window).scroll(function(){
        if($(".core").get(0)&&($(".core").offset().top-$(document).scrollTop()<=600)){
            showActive($(".core_list li"),200,0,"ani-p-li",false);
            $(".core .title").removeClass("ani-b-t");
        }
        if($(".about").get(0)&&($(".about").offset().top-$(document).scrollTop()<=600)){
            $(".about .title").removeClass("ani-b-t");
            showActive($(".about .trans00"),200,0,"ani-p-li",false);
            showActive($(".about li"),200,0,"ani-p-l",false);
        }
        if($(".partner").get(0)&&($(".partner").offset().top-$(document).scrollTop()<=600)){
             showActive($(".partner .trans00"),300,0,"ani-p-l",false);
             $(".partner .partner_pic").removeClass("ani-cycle");
        }
        if($(".case").get(0)&&($(".case").offset().top-$(document).scrollTop()<=600)){
             showActive($(".case .title"),200,0,"ani-b-t",false);
             showActive($(".case .trans00"),100,0,"ani-p-li",false);
        }
        if($(".news").get(0)&&($(".news").offset().top-$(document).scrollTop()<=600)){
            $(".news .news_swiper").removeClass("ani-p-li");
             showActive($(".news .trans00"),300,0,"ani-p-l",false);
        }
        if($(".news").get(0)&&($(".news").offset().top-$(document).scrollTop()<=600)){
             showActive($(".news .title .trans01"),200,0,"ani-b-t",false);
             showActive($(".news .box"),200,0,"ani-p-li",false);
        }
    })
    setTimeout(function(){
        $(".ny_pad").removeClass("ani-pages");
        $(".pub_title").removeClass("ani-b-t");
        $(".i_now_address").removeClass("ani-p-l");
        $(".map").removeClass("ani-p-r");
        showActive($(".pub_cate li"),200,0,"ani-p-l",false);
        showActive($(".pub_cate li"),200,0,"ani-p-li",false);
        showActive($(".i_about"),200,0,"ani-p-li",false);
        showActive($(".i_case .trans00"),200,0,"ani-p-l",false);
        showActive($(".i_case_list li"),200,0,"ani-p-li",false);
        showActive($(".i_contact .trans00"),200,0,"ani-p-li",false);
        showActive($(".i_core .trans02"),200,0,"ani-r-pic",false);
        showActive($(".i_news .trans00"),200,0,"ani-p-li",false);
        showActive($(".i_video_list li"),200,0,"ani-p-li",false);
         setTimeout(function(){
            $(".pages").removeClass("ani-p-li");
        },2000)
    })
    stopSwiper(news_swiper,$(".news_swiper"))
    stopSwiper(case_swiper,$(".case_swiper"))
})
// 轮播图悬停函数
function stopSwiper(swiperName,swiperBox){
    swiperBox.on("mouseenter",function(){
        swiperName.autoplay.stop();
    })
    swiperBox.on("mouseleave",function(){
        swiperName.autoplay.start();
    })

}
function showActive(li,t1,t2,rc,p){
    setTimeout(function(){
        var time= 0;
        var set=setInterval(function(){
            if(p){
                li.eq(time).addClass(rc);
                time++;
                if(time>=li.length){
                    clearInterval(set);
                }
            }else{
                li.eq(time).removeClass(rc);
                time++;
                if(time>=li.length){
                    clearInterval(set);
                }
            }
        },t1);
    },t2);
}